"use strict";

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const rule = require("../../../lib/rules/must-else-end"),
  RuleTester = require("eslint").RuleTester;


//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

const ruleTester = new RuleTester();
ruleTester.run("must-else-end", rule, {
  valid: [
    {
      code: "if (a===1) { console.log(1) } else if (a===2){ console.log(2) } else {}"
    }
  ],

  invalid: [
    {
      code: `if(a===1){
        console.log(111)
      }else if(a===2){
        console.log(222)
      }`,
      errors: [{ messageId: "missingFinalElse", type: "IfStatement" }],
      output: `if(a===1){
        console.log(111)
      }else if(a===2){
        console.log(222)
      } else {}`
    },
  ],
});
